package com.czk.gulimall.seckill.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * redisson的配置
 *
 * @Author:ChenZhangKun
 * @Date: 2022/1/24 14:06
 */
@Configuration
public class MyRedissonConfig {
    /**
     * 配置redissonClient
     * 所有的操作都要通过这个对象
     *
     * @return
     */
    @Bean
    public RedissonClient redisson() {
        // 创建配置
        Config config = new Config();
        config.useSingleServer()
                .setAddress("redis://localhost:6379");
        // 创建实例
        return Redisson.create(config);
    }
}
